<template>
  <!-- 公众号二维码 -->
	<div class="code-dialog shop-code">
    <van-popup
      v-model="dialogVisible"
      class="code-pop"
    >
      <div class="code-wrap">
        <div class="img-wrap">
          <img :src="wx_qrcode" alt="" class="item_qrcode">
        </div>
        <div class="msg" v-if="fans_message_hints">{{fans_message_hints}}</div>
      </div>
    </van-popup>
  </div>
</template>

<script>
import Vue from 'vue'
  import { publicAccountInformation } from '@/api/login'
  export default Vue.extend({
    name: 'index',
    props: {
      visible: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {
        dialogVisible: false,
        wx_qrcode: '',
        fans_message_hints: ''
      }
    },
    methods: {
      init() {
        publicAccountInformation().then(res => {
          if (res.status == 1) {
            this.wx_qrcode = res.data.wx_qrcode
            this.fans_message_hints = res.data.fans_message_hints
          } else {
            this.$Error(res.msg)
          }
        })
      },
      // 点击关闭按钮
      closeDialog() {
        // this.dialogVisible = false
      }
    },
    created() {
      this.init()
    }
  })
</script>

<style lang="scss">
  @import "src/styles/mixin";
  @import "src/styles/variables";
  .code-dialog{
    background: #fff;
    position: relative;
    .code-pop{
      overflow:hidden;
      border-radius:20px;
      width:600px;
    }
    .code-wrap{
      padding:20px;
      .item_qrcode{
        display:block;
        width:100%;
        max-height:960px;
      }
      .msg{
        padding-bottom:10px;
        font-size:28px;
        text-align:center;
        color:#999;
      }
    }
  }
</style>
